<?php 
// Standard configuration file
include("config.inc.php");

// Logout
if(isset($_GET['logout'])) CUserAuth::logout();

// Check for existing user-session
if(!CUserAuth::isLoggedIn() || CUserAuth::passwdExpired()) header("LOCATION: login.php");
if($_SESSION['status'] == 5) {
    header("LOCATION: changePassword.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<!-- CSS-File -->
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<link rel="stylesheet" type="text/css" href="css/menubox.css" />
<link rel="stylesheet" type="text/css" href="css/form.css" />
<link rel="stylesheet" type="text/css" href="css/table.css" />
<link rel="stylesheet" href="js/development-bundle/themes/base/jquery.ui.all.css">
<link rel="stylesheet" href="js/DataTables/media/css/demo_table.css">
<!-- CSS-File End -->
<!-- JS-File -->
        <script src="js/development-bundle/jquery-1.6.2.js"></script>
	<script src="js/development-bundle/ui/jquery.ui.core.js"></script>
	<script src="js/development-bundle/ui/jquery.ui.widget.js"></script>
	<script src="js/development-bundle/ui/jquery.ui.datepicker.js"></script>
        <script src="js/DataTables/media/js/jquery.dataTables.min.js"></script>
<!-- JS-File End -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Kundenstammdatensystem</title>
</head>
<body>
<?php
if ( isset ($_GET['page']) ){
        switch ($_GET['page'])
        {
            // Staff
            case 'staff-view': $include = "module/staff/staff_view.php"; break;
            case 'staff-create': $include = "module/staff/form_1.php"; break;
            case 'staff-enable': $include = "module/staff/vorgemerkt.php"; break;    
            case 'staff-edit': $include = "module/staff/mabe.php"; break;
            case 'staff_delete': $include = "module/staff/staff_delete.php"; break;
            case 'mabe1': $include = "module/staff/mabe1.php"; break;
            case 'mabe2': $include = "module/staff/mabe2.php"; break;
            case 'mapa3': $include = "module/staff/mapa3.php"; break;
            case 'update': $include = "module/staff/update.php"; break;
            
            case 'del1': $include = "module/staff/del1.php"; break;
            case 'del11': $include = "module/staff/del11.php"; break;
            case 'del12': $include = "module/staff/del12.php"; break;
            case 'del13': $include = "module/staff/del13.php"; break;
            case 'del2': $include = "module/staff/del2.php"; break;
            case 'deldel': $include = "module/staff/deldel.php"; break;
            // Staff End

            // Customer
            case 'customer-view': $include = "module/customer/customer_view.php"; break;
            case 'customer-create': $include = "module/customer/customer_create.php"; break;
            case 'customer-edit': $include = "module/customer/customer_edit.php"; break;
            case 'customer-enable': $include = "module/customer/customer_enable.php"; break;
            case 'customer-delete': $include = "module/customer/customer_delete.php"; break;
            case 'customer-edit-options': $include = "module/customer/customer_edit_options.php"; break;
            case 'customer-delete-options': $include = "module/customer/customer_delete_options.php"; break;
            case 'customer-transfer': $include = "module/customer/customer_transfer.php"; break;
            case 'customer-gstelle': $include = "module/customer/customer_gstelle.php"; break;
            // Customer End
            
            // Administrator
            case 'administrator-create': $include = "module/administrator/administrator_create.php"; break;
            case 'administrator-view': $include = "module/administrator/administrator_view.php"; break;
            case 'administrator-approve': $include = "module/administrator/administrator_approve.php"; break;
            case 'administrator-edit': $include = "module/administrator/administrator_edit.php"; break;
            case 'administrator-delete': $include = "module/administrator/administrator_delete.php"; break;
            // Administrator End
            // 
            // Supervisor
            case 'supervisor-zentrale': $include = "module/supervisor/supervisor_zentrale.php"; break;
            case 'supervisor-bezirk': $include = "module/supervisor/supervisor_bezirk.php"; break;
            case 'supervisor-filiale': $include = "module/supervisor/supervisor_filiale.php"; break;
            // Supervisor End
            
            // Contact
            case 'email-senden': $include = "module/contact/send_mail.php"; break;
            case 'kontaktformular': $include = "module/contact/contact_form.php"; break;
            case 'kontakthistorie': $include = "module/contact/contacthistory.php"; break;
            case 'contact-gstelle': $include = "module/contact/contact_gstelle.php"; break;
            // Contact End
            
            // Report
            case 'berichte-geburtstage': $include = "module/report/report_birthday.php"; break;
            case 'berichte-infos': $include = "module/report/report_gstelle_infos.php"; break;
            // Report End
            
            // Misc
            case 'access-denied': $include = "module/misc/access_denied.php"; break;
            // Misc End

            // Test-pages
            case '1': $include = "_TEST/Matias/aGhost.php"; break;
            case '2': $include = "_TEST/Matias/ma_start.php"; break;
            case '3': $include = "_TEST/Matias/testThisAndThat.php"; break;
            case '4': $include = "ins_maad_1.php"; break;
            case '5': $include = "ins_maad_2.php"; break;
            case '6': $include = "ins_maad_3.php"; break;
            case '7': $include = "login.php"; break;
            case '8': $include = "login.php"; break;
            case '9': $include = "_TEST/Kai/form.php"; break;
            // Test-pages end
            default: $include = "module/misc/content.php";
        }
}else{
        $include = "module/misc/content.php";
}
?>
<!-- Main-Wrap -->
<div id="wrap-main">

    <!-- Head-Wrap -->
    <div id="wrap-head">
        <?php include("module/misc/header.php"); ?>
    </div>
    <!-- Head-Wrap End -->
    
    <!-- Content-Wrap -->
    <div id="wrap-content">
    	
        <!-- Content-Left -->
        <div id="content-left">
        	<!-- Navigation -->
            <div class="menubox">
                <?php include("module/misc/navigation.php"); ?>
            </div>
            <!-- Navigation End -->
                    
        </div>
        <!-- Content-Left End -->
    
        <!-- Content-Center -->
        <div id="content-center">
            <div id="content-title"><?= $_SESSION['title'] ?></div>
			<?php include($include); ?>
        </div>
        <!-- Content-Center End -->
        
        <!-- Clear -->
        <div class="clear"></div>
        <!-- Clear End -->
    
    </div>
    <!-- Content-Wrap-End -->
    
    <!-- Footer-Wrap -->
    <div id="wrap-footer">
        <?php include("module/misc/footer.php"); ?>
    </div>
    <!-- Footer-Wrap End -->

</div>
<!-- Main-Wrap End -->

</body>
</html>